<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">

<%@ page session="true" %>
<%@ page import="javax.portlet.*"%>
<%@ page import="java.util.List" %>
<%@ page import="pits.dao.TakenCourseBriefDAO" %>
<%@ page import="pits.dao.EditTakenCompanyInfoDAO" %>
<%@ page import="pits.dto.TakenCourseBriefDTO" %>
<%@ page import="pits.dao.TakenProjectBriefDAO" %>
<%@ page import="pits.dto.TakenProjectBriefDTO" %>
<%@ page import="pits.dto.EmployeeDTO" %>
<%@ page import="pits.util.Constants" %>
<%@ taglib uri="http://java.sun.com/portlet" prefix="portlet"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>

<portlet:defineObjects />

<html>

<script type="text/javascript">
	function getForm(namespace, name) {
			return document.forms[namespace + name];
	}

	function submitForm(namespace, name, action) {
			var frm = getForm(namespace, name);
			frm.txtAction.value = action;
			frm.submitLink.value = "EmployeeSearchDetail.jsp";
			frm.submit();
	}

</script>

<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Personal Information Tracking System</title>
<meta name="keywords" content="" />
<meta name="description" content="" />

<script type="text/javascript" src="simpletreemenu.js">
/***********************************************
* Simple Tree Menu- Â© Dynamic Drive DHTML code library (www.dynamicdrive.com)
* This notice MUST stay intact for legal use
* Visit Dynamic Drive at http://www.dynamicdrive.com/ for full source code
***********************************************/
</script>

<link rel="stylesheet" type="text/css" href="style/simpletree.css" />
<link href="style/style.css" rel="stylesheet" type="text/css" media="screen" /></head>

<body>
<form name="<portlet:namespace/>myForm" action="<portlet:actionURL/>" method="POST">
<input type="hidden" name="txtAction"/>
<input type="hidden" name="submitLink"/>
<input type="hidden" name="companyID"/>
<input type="hidden" name="courseID"/>
<input type="hidden" name="projectID"/>

<p align="right">
	You are logging in as 
	<a href="#" onclick="submitForm('<portlet:namespace/>', 'myForm', 'getEmployeeInfo')"><b>${sessionScope.userName}</b></a>
	! &nbsp;
	<a href="#" onclick="submitForm('<portlet:namespace/>', 'myForm', 'home')">Home</a>
	| &nbsp;
	<a href="#" onclick="submitForm('<portlet:namespace/>', 'myForm', 'logout')">Logout</a>
</p>
</form>
<table>
	<tr>			
		<td>
			<table border="1">
				<tr>
					<td><h2 class="title">Employee Information </h2></td>
				</tr>
				<tr>
					<td><em>Personal Information </em></td>
				</tr>
				<tr>
					<td>
						<%
						EmployeeDTO resultEmp = (EmployeeDTO) session.getAttribute("resultEmp");
						resultEmp.setDepartexps(new EditTakenCompanyInfoDAO().getDepartexps(resultEmp.getEmpID()));
						%>
						<table border="1" width="100%">
							<tr>								
								<td align="center" valign="middle">ID</td>
								<td align="center" valign="middle">Name</td>
								<td align="center" valign="middle">Birthdate</td>
								<td align="center" valign="middle">Address</td>
								<td align="center" valign="middle">Email</td>
								<td align="center" valign="middle">Phone</td>						
							</tr>
							<tr>
								<td align="center"><%=resultEmp.getEmpID() %></td>
								<td align="left"><%=resultEmp.getName() %></td>
								<td align="center"><%=resultEmp.getBirthday() %></td>
								<td align="left"><%=resultEmp.getAddress() %></td>
								<td align="left"><%=resultEmp.getEmail() %></td>
								<td align="center"><%=resultEmp.getPhone() %></td>
							</tr>							
						</table>
					</td>
				</tr>
				
				<tr>
					<td><em>Experience</em></td>
				</tr>
				<tr>
					<td>
					<input type="hidden" name="txtAction"/>
					<input type="hidden" name="submitLink"/>
					<input type="hidden" name="departID"/>
						<table border="1" width="100%">
							<tr>
								<td align="center" valign="middle">&nbsp;Company&nbsp;</td>
								<td align="center" valign="middle">&nbsp;Address&nbsp;</td>
								<td align="center" valign="middle">&nbsp;Phone&nbsp;</td>
								<td align="center" valign="middle">&nbsp;Department&nbsp;</td>
								<td align="center" valign="middle">&nbsp;StartDate&nbsp;</td>
								<td align="center" valign="middle">&nbsp;EndDate&nbsp;</td>
								<td align="center" valign="middle">&nbsp;Role&nbsp;</td>
								<td align="center" valign="middle">&nbsp;Short Description&nbsp;</td>
							</tr>
							<%
							for (int i = 0; i < resultEmp.getDepartexps().size(); i++) {
							%>
								<tr>
									<td align="left" valign="middle">
										<a href="#" onclick="
											document.forms['<portlet:namespace/>mayForm'].companyID.value = '' + <%=resultEmp.getDepartexps().get(i).getDepartment().getCompany().getCompanyID() %>;
											submitForm('<portlet:namespace/>', 'myForm', 'editProjectInfo');
										">
											<%=resultEmp.getDepartexps().get(i).getDepartment().getCompany().getComName() %>
										</a>
									</td>						
									<td align="left"><%=resultEmp.getDepartexps().get(i).getDepartment().getCompany().getAddress() %></td>
									<td align="left"><%=resultEmp.getDepartexps().get(i).getDepartment().getCompany().getPhone() %></td>
								 	<td align="center"><%=resultEmp.getDepartexps().get(i).getDepartment().getDepartName() %></td>
								 	<td align="left"><%=resultEmp.getDepartexps().get(i).getStartDate() %></td>
									<td align="center"><%=resultEmp.getDepartexps().get(i).getEndDate() %></td>
									<td align="center"><%=resultEmp.getDepartexps().get(i).getRole().getRole() %></td>
									<td align="left"><%=resultEmp.getDepartexps().get(i).getDescription() %></td>
								</tr>
							<%
							}
							%>
						</table>
					</td>
				</tr>
					
				<tr>
					<td><em>Taken Course(s)</em></td>
				</tr>
				
				<tr>
					<td>
					<input type="hidden" name="txtAction"/>
					<input type="hidden" name="submitLink"/>
					<input type="hidden" name="courseID"/>
						<table border="1" width="100%">
							<tr align="center" valign="middle">
								<td rowspan="2">&nbsp;Name&nbsp;</td>
								<td rowspan="2">&nbsp;Department/Institute Issued&nbsp;</td>
								<td rowspan="2">&nbsp;Period (day)&nbsp;</td>
								<td rowspan="2">&nbsp;Description&nbsp;</td>
								<td colspan="3">&nbsp;Technology&nbsp;</td>
								<td rowspan="2">&nbsp;Grade&nbsp;</td>
								<td rowspan="2">&nbsp;Date issued&nbsp;</td>					
							</tr>
							<tr align="center" valign="middle">
								<td>Language</td>
								<td>Framework/Technology</td>
								<td>DBMS</td>
							</tr>
							
							<%
							List<TakenCourseBriefDTO> takenCourseList = new TakenCourseBriefDAO().getData("" + resultEmp.getEmpID());
							for (int i = 0; i < takenCourseList.size(); i++) {
							%>
							<tr>
								<td align="left" valign="middle">
									<a href="#" onclick="
										document.forms['<portlet:namespace/>myForm'].courseID.value = '' + <%=takenCourseList.get(i).getCourseID() %>;
										submitForm('<portlet:namespace/>', 'myForm', 'editCourseInfo');
									">
										<%=takenCourseList.get(i).getName() %>
									</a>
								</td>
								<td align="left" align="center" valign="middle"><%=takenCourseList.get(i).getDepartName() %></td>
								<td align="left" valign="middle"><%=takenCourseList.get(i).getPeriod() %></td>
								<td align="left" valign="middle"><%=takenCourseList.get(i).getDescription() %></td>
								<td align="center" valign="middle"><%=takenCourseList.get(i).getLang() %></td>
								<td align="center" valign="middle"><%=takenCourseList.get(i).getFrameTech() %></td>
								<td align="center" valign="middle"><%=takenCourseList.get(i).getDBMS() %></td>
								<td align="center" valign="middle"><%=takenCourseList.get(i).getGrade() %></td>
								<td align="left" valign="middle"><%=takenCourseList.get(i).getDateIssused() %></td>
							</tr>
							<%}%>
							
						</table>
					</td>
				</tr>
					
				<tr>
					<td><em>Taken Project(s)</em></td>
				</tr>
				<tr>
					<td>
					<input type="hidden" name="txtAction"/>
					<input type="hidden" name="submitLink"/>
					<input type="hidden" name="projectID"/>
						<table border="1" width="100%">
							<tr align="center" valign="middle">
								<td><div align="center">&nbsp;Project Name</div></td>
								<td><div align="center">&nbsp;Department&nbsp;</div></td>
								<td><div align="center">&nbsp;Start Date&nbsp;</div></td>							
								<td><div align="center">&nbsp;End Date&nbsp;</div></td>
								<td><div align="center">&nbsp;Role&nbsp;</div></td>
								<td><div align="center">&nbsp;Languages&nbsp;</div></td>
								<td><div align="center">&nbsp;Framework/Technology&nbsp;</div></td>
								<td><div align="center">&nbsp;Database&nbsp;</div></td>
								<td><div align="center">&nbsp;More Decriptions&nbsp;</div></td>
							</tr>
							
							<%
							List<TakenProjectBriefDTO> takenProjectList = new TakenProjectBriefDAO().getData("" + resultEmp.getEmpID());
							for (int i = 0; i < takenProjectList.size(); i++) {
							%>
							<tr>
							 	<td align="left" valign="middle">
									<a href="#" onclick="
										document.forms['<portlet:namespace/>myForm'].projectID.value = '' + <%=takenProjectList.get(i).getProjectID() %>;
										submitForm('<portlet:namespace/>', 'myForm', 'editProjectInfo');
									">
										<%=takenProjectList.get(i).getName() %>
									</a>
								</td>
								<td align="left" valign="middle"><%=takenProjectList.get(i).getDepartName() %></td>
								<td align="left" valign="middle"><%=takenProjectList.get(i).getStartDate() %></td>	
								<td align="left" valign="middle"><%=takenProjectList.get(i).getEndDate() %></td>
								<td align="left" valign="middle"><%=takenProjectList.get(i).getRole() %></td>
								<td align="left" valign="middle"><%=takenProjectList.get(i).getLanguages() %></td>
								<td align="left" valign="middle"><%=takenProjectList.get(i).getFrameTech() %></td>
								<td align="left" valign="middle"><%=takenProjectList.get(i).getDBMS() %></td>
								<td align="left" valign="middle"><%=takenProjectList.get(i).getDescription() %></td>
							</tr>
							<%} %>
						</table>
					</td>
				</tr>
			</table>			
		</td>
	</tr>
	<tr>
		<td>
			<input type="button" value="Cancel" onclick="
				submitForm('<portlet:namespace/>', 'myForm', 'cancel');
			"/>		
		</td>
	</tr>
	<tr>
		<td>&nbsp;</td>
	</tr>
</table>
</body>
</html>